Carryout word calculation for cyclic shift registers

ABSTRACT

A method of calculating the carry out word from a shift register such as a CRC encoder, decoder or error trapping circuit having feedback taps at positions determined by a generator polynomial, in which the carryout word of length K is calculated from the formula:  
     carryout_word=select_word.top_word_matrix  
     carryout_word being a  1× K row vector, top_word_matrix being calculated from the top K bits of the shift register, and select word being a  1× K row vector determined from the generator polynomial.

[0001] The present invention relates to carryout word calculation for cyclic shift registers such as CRC encoder, decoder and error trapping circuits.

[0002] FIGS. 1(a), 1(b) and 1(c) show examples of CRC encoder, decoder and error trapping circuits. The positions of the feedback taps are determined by the generator polynomial corresponding to the code.

[0003] Thus, FIG. 1 shows a CRC codec with generator polynomial

G(X)=X ³ +X+1

[0004]FIG. 1(a) showing the CRC encoder and FIG. 1(b) the decoder. In the traditional operation of these circuits, the contents of the shift register (known as parity bits for encoder and syndrome for decoder) are shifted in a bit-wise manner.

[0005] It has been proposed to shift the content of the shift register for syndrome calculation byte-by-byte instead of bit-by-bit. This is described in an article by Jack Crenshaw in Embedded Systems Programming, January 1992, pages 34-40.

[0006] In our copending (unpublished) patent application 0116157.9 this “multiple bit shifting” is extended to the process of error trapping and error detection. Furthermore, it is suggested that these processes be carried out in a word-wise rather than byte-wise manner.

[0007] The word-wise CRC calculation includes two main steps, feedback word calculation and register content update. Assume that the number of taps is L and the word length is K. The feedback word consists the first K bits dropped out at left end of the circuit (see FIG. 1). The feedback word can be calculated recursively using the following equation: fdbk_word_(n) = fdbk_word_(n−1) ⊕ (fdbk_(—) word_(n−1)>>tap₁) ⊕ (fdbk_word_(n−1)>>tap₂) ...... ⊕ (fdbk_word_(n−1)>>tap_(L))

[0008] n=1, 2, 3. . . N

[0009] taking the example of a decoder:

fdbk_word₀=current_syndrome_word,

[0010] In the foregoing, syndrome_word is the existing contents of the shift register and tap_(x)

[0011] can be determined as the difference between the order of the corresponding tap and the highest order of the generator polynomial.

[0012] For example, given a generator polynomial. G(X)=X⁶+X⁵+X³+X²+X¹1, the tap positions, tap₀₋₆ are determined as:

Tap0=0(corresponds to X⁶), Tap1=1(corresponds to X⁵)

Tap2=3(corresponds to X³), Tap3=4(corresponds to X²)

Tap4=5(corresponds to X¹), Tap5=6(corresponds to X⁵)

[0013] The number of recursions (N) can be determined using the following equation:

N=(K−1)/tap ₁   [2]

[0014] After obtaining the feedback word, the syndrome word can be updated using the following formula: new_sydrome = next_word ⊕ [fdbk_word<< (K-tap₁)]⊕ [fdbk_word<<(K-tap₂)] ...... [fdbk_word<<(K-tap_(L))]

[0015] As the following calculations will show, if the CRC codec has a large number of feedback taps, the calculation of the feedback word could be time consuming and complicated, and also take up a lot of processing power. Thus, it would be advantageous if this process could be made faster.

[0016] The present invention provides a method of calculating a carryout word of length K from a cyclic shift register as described in claim 1. The expression “carryout word of length K” refers to the next K bits output from the shift register. In the case of an encoder or error trapping circuit the carryout word will be the feedback word used to up-date the content of the shift register. In the case of an encoder, the next K bits of the input binary sequence are modulo 2 added to the carryout word to form a feedback word (see claim 4).

[0017] In fact the definitions “encoder” and “decoder” are somewhat arbitrary since it can be demonstrated that the two shift registers are mathematically equivalent, see Lin/Costello “Error Control Coding: Fundamentals and Applications” Prentice Hall 1983, pages 100 and 101, FIGS. 4.6 and 4.7.

[0018] Since the select_word depends only on the generator polynomial, it can be calculated separately (e.g. offline) and stored, and this represents a significant saving in processing power and hence time. The top_word_matrix on the other hand needs to be calculated from the input binary data.

[0019] Preferred features of the invention are described in the subsidiary claims.

[0020] An embodiment of the invention will now be described by way of example only and with reference to the accompanying drawings in which:

[0021]FIG. 1(a) shows a typical CRC (cyclic redundancy check) encoder with generator polynomial

G(X)=X ³ +X+1;

[0022]FIG. 1(b) shows a CRC decoder corresponding to the encoder of FIG. 1(a);

[0023]FIG. 1(c) shows an error trapping circuit corresponding to FIG. (b); and

[0024]FIG. 2 shows an example of bit-wise CRC calculation by way of background.

EXAMPLE 1

[0025] This example demonstrates the working principle of a Byte-Wise (K=8) CRC decoder with reference to FIG. 2. As noted above, in a decoder the carryout word is the same as the feedback word and is thus referred to in the following as the feedback word.

[0026] Given the generator polynomial,

G(X)=X ⁶ +X ⁵ +X ³ +X ² +X ¹+1

[0027] and a received binary sequence:

[0028] 10011101101101

[0029] As shown in FIG. 2, the 6-bit syndrome is calculated bit by bit to give the result 111101. The same syndrome can also be calculated using the byte-wise method:

[0030] Feedback Byte Calculation:

[0031] Using the equation [2], the recursion number is calculated as, Recursion_num= (8-1)/1=7 fdbk_word₁ = fdbk_word_(0 ⊕ (fdbk)_word₀><1) ⊕ (fdbk_word_(n−1) >>4) ⊕ (fdbk_word_(0>>5 (fdbk)_word₀>>6)

[0032] $\begin{matrix} {\quad {= {10011101 \oplus 01001110 \oplus 00010011 \oplus 00001001 \oplus 00000100\quad \oplus 00000010}}} \\ {= 11001111} \end{matrix}$

[0033] repeating the above calculation, the following results are obtained subsequently as: fdbk_word₂ = 10111000, fdbk_word₃ = 11111111, fdbk_word₄ = 10010100, fdbk_word₅ = 11000011, fdbk_word₆ = 10110011, fdbk_word₇ ₌ ₁₁₁₁₀₀₀₀ fdbk_word = fdbk_word₇ = 11110000

[0034] substituting the fdbk_word into equation [3]. The register content is updated as: new_register_content = next_word ⊕ fdbk_word₃ = [fdbk_word>>7] ⊕ [fdbk_word<<5] ⊕ [fdk_word<<4] ⊕ [fdbk_word<<3] ⊕ [fdbk_word<<2]

[0035] $\begin{matrix} {\quad {= {10110100 \oplus 00000000 \oplus 00000000 \oplus 00000000 \oplus 10000000 \oplus 11000000}}} \\ {= 11110100} \end{matrix}$

[0036] The most significant 6 bits represent the new syndrome.

[0037] The result matches exactly the one shown in FIG. 2.

[0038] As shown in the above example, if a CRC codec consists a large number of feedback taps, the calculation of the carryout word could be rather complicated, and time-consuming. In order to speed up the run-time calculation of the feedback word, a new technique is invented, so that, the carryout word can be calculated in one step, rather than numbers of recursions.

[0039] In general the carryout word is a function of the top word (see FIG. 2), and their relationship can be described with the following equation

carryout_word=select_word.top_word_matrix   [4]

[0040] where, carryout_word represents a 1×K row vector containing K feedback bits. Top_word_matrix is a K×K matrix which contain K right-shifted top words, as shown below, $\begin{matrix} {{{top\_ word}{\_ matrix}} = \begin{bmatrix} {top\_ word} \\ {{top\_ word}\operatorname{>>}1} \\ {{top\_ word}\operatorname{>>}2} \\ \vdots \\ \left. {{top\_ word}\operatorname{>>}\left( {{K -}1} \right.} \right) \end{bmatrix}} & \lbrack 5\rbrack \end{matrix}$

[0041] with the top_word representing a 1×K row vector.

[0042] The select_word is a constant 1×16 row vector that can be calculated off-line using the following equations: $\begin{matrix} {{select\_ word}_{m} = {{generator\_ polynormial}{{\_ word} \cdot \begin{bmatrix} {select\_ word}_{m - 1} \\ {{select\_ word}_{m - 1}\operatorname{>>}1} \\ {{select\_ word}_{m - 1}\operatorname{>>}2} \\ \vdots \\ \left. {{select\_ word}_{m - 1}\operatorname{>>}{(K-1}} \right) \end{bmatrix}}}} & \lbrack 6\rbrack \end{matrix}$

[0043] m=1,2,3 . . . M,

select_word₀=generator_polynomial_word   [7]

[0044] M is the number of recursions required to evaluate the select word, it is calculated using the following equation:

M=((K−1)/tap ₁)−1   [8]

[0045] The generator_polynomial_word is also a 1×K row vector representing the generator polynomial. For example, if K equals 8 and the generator polynomial G(X)=X⁶+X⁵+X³+X²+X¹+1, the generator_polynomial_word is determined as [1 1 0 1 1 1 1 0].

EXAMPLE 2

[0046] In the following example, the new technique presented above is applied, so that a byte-wise syndrome update can be completed in only one step:

[0047] Given the generator polynomial, G(X)=X⁶+X⁵+X³+X²+X¹+1 (as in example 1), the generator_polynomial_word is determined as [1 1 0 1 1 1 1 0].

[0048] Using Equation [6],[7] and [8], the select_word corresponding to this particular generator polynomial is calculated as follows:

M=((8−1)/1)−1=6

[0049] ${select\_ word}_{1} = {{\lbrack 11011110\rbrack \cdot \begin{bmatrix} 11011110 \\ 01101111 \\ 00110111 \\ 00011011 \\ 00001101 \\ 00000111 \\ 00000011 \\ 00000001 \end{bmatrix}} = \lbrack 10100010\rbrack}$

[0050] subsequently,

[0051] select_word₂=[10100010], select_word₃=[11101010], select_word₄=[10001000],

[0052] select_word₅=[11100100],

[0053] and,

[0054] select_word=select_word₆=[11100100].

[0055] Using the same received sequence as in example 1, 10011101101101, the feedback word can be calculated only in one step using equation [4]. ${fdbk\_ word} = {{\lbrack 11100100\rbrack \cdot \begin{bmatrix} 10011101 \\ 01001110 \\ 00100111 \\ 00010011 \\ 00001001 \\ 00000100 \\ 00000010 \\ 00000001 \end{bmatrix}} = \lbrack 11110000\rbrack}$

[0056] The result shown above matches exactly the fdbk_word calculated in Example 1.

[0057] A novel technique has been presented which allows the feedback word or more generally a carryout word to be calculated in only one step with a pre-calculated select_word.

[0058] In Word-Wise CRC codecs, the feedback word would normally be calculated using a recursive operation. Such operation becomes complicated and time-consuming, if the codec has a large number of the feedback taps.

[0059] Considering a particular CRC codec, which has P feedback taps, and the position of the first tap is tap₁, the number (N) of logic operations (including word-wise shift and XOR) required for the feedback word calculation is estimated as follows: $N = {{2 \times P \times M} = \frac{2 \times P \times \left( {K - 1} \right)}{tap1}}$

[0060] with, P≦K, tap₁≧1, the maximal value of N is estimated as $\begin{matrix} {N_{\max} = {\frac{2 \times K \times \left( {K - 1} \right)}{1} = {2{K\left( {K - 1} \right)}}}} & \lbrack 9\rbrack \end{matrix}$

[0061] where, K is the word length. Assuming K is much larger than 1, it yields:

N_(max)≈2K²   [10]

[0062] On the other hand, if using the new technique, with equation [4], the maximum number of required logic operations, N′_(max) is only,

N′_(max)=2K,   [11]

[0063] in the worst situation, where the select_word contains only 1s.

[0064] As shown above, the new technique requires much less logic operations, Therefore by using this technique in a Word-Wise CRC codec, a significant improvement of the processing speed can be achieved. 

1. A method of calculating a carryout word of length k from a cyclic shift register having feedback taps at positions determined by a generator polynomial, wherein the carryout word is calculated using the equation: carryout_word=select_word.top_word_matrix ${{wherein}\quad {top\_ word}{\_ matrix}} = \begin{bmatrix} {top\_ word} \\ {{top\_ word}\operatorname{>>}1} \\ {{top\_ word}\operatorname{>>}2} \\ \vdots \\ \left. {{top\_ word}\operatorname{>>}\left( {{K -}1} \right.} \right) \end{bmatrix}$

with the top_word comprising a 1×K row vector and wherein: ${select\_ word}_{m} = {{generator\_ polynormial}{{\_ word} \cdot \begin{bmatrix} {select\_ word}_{m - 1} \\ {{select\_ word}_{m - 1}\operatorname{>>}1} \\ {{select\_ word}_{m - 1}\operatorname{>>}2} \\ \vdots \\ \left. {{select\_ word}_{m - 1}\operatorname{>>}{(K-1}} \right) \end{bmatrix}}}$

with m=1, 2, 3 . . .M and M=(K−1/tap₁)−1, wherein tap₁ is the difference between the orders of the highest and second highest order terms in the generator polynomial and >> represent shifts in the opposite direction to the shifting direction of the shift register.
 2. A method as claimed in claim 1 in which the select_word is calculated from the generator polynomial and stored prior to the calculation of the carryout word.
 3. A method as claimed in claim 1 or 2 for forming cyclic code words including modulo 2 adding the carryout word to the next K bits of an input binary sequence to form a feedback word, and applying the feedback word to the feedback taps of the shift register.
 4. A method as claimed in claim 1 for encoding an input binary sequence in which the updated contents of the shift register are calculated from the formula: fdbk_word=carryout_word ⊕ next K bits of input binary sequence new_register_content = [fdbk word <<(K-tap₁)]⊕ [fdbk_word<< (K-tap_(2)]...................) ⊕ [fdbk_word<<(K-tap_(I))]

in which L is the number of taps.
 5. A method as claimed in claim 1 for calculating a syndrome form a cyclic code word in which a new syndrome is calculated from the formula: new_syndrome = next_word ⊕ [carryout_word <<(K-tap₁)] [carryout_word<<(K-tap₂)]. . . [carryout_word<<(K-tap_(L))]

in which next_word is the next K bits of the cyclic code word to be input to the shift register and L is the number of taps.
 6. Use of the method of claim 1 for up-dating the contents of an error trapping circuit in which the new register content is calculated using the formula: new_register_content = [carryout_word<< (K-tap₁)] ⊕ [carryout_word<<(K-tap₂)] ⊕.......⊕[carryout_word (K-tap₁]

where L is the number of taps. 